package com.ouc.openplatform.zykt.orderManage.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ouc.openplatform.pojo.EUDataGridResult;
import com.ouc.openplatform.zykt.orderManage.dao.CS_TestProdInfoValueDao;
import com.ouc.openplatform.zykt.orderManage.model.CS_TestProdInfoValueModel;
import com.ouc.openplatform.zykt.orderManage.model.CS_TestProdInfoValueVo;
import com.ouc.openplatform.zykt.orderManage.service.CS_TestProdInfoValueService;

public class CS_TestProdInfoValueServiceImpl implements CS_TestProdInfoValueService {

	private CS_TestProdInfoValueDao testProdInfoValueDao;

	public CS_TestProdInfoValueDao getTestProdInfoValueDao() {
		return testProdInfoValueDao;
	}

	public void setTestProdInfoValueDao(CS_TestProdInfoValueDao testProdInfoValueDao) {
		this.testProdInfoValueDao = testProdInfoValueDao;
	}

	@Override
	public EUDataGridResult getAllOrderDetail(String orderNo,int page, int rows) {
		// 分页处理
		PageHelper.startPage(page, rows);
		List<CS_TestProdInfoValueModel> testProdInfoValueModel = testProdInfoValueDao.listAll(orderNo);
		// 创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(testProdInfoValueModel);
		// 取记录总条数
		PageInfo<CS_TestProdInfoValueModel> pageInfo = new PageInfo<CS_TestProdInfoValueModel>(testProdInfoValueModel);
		result.setTotal(pageInfo.getTotal());
		return result;
	}

	@Override
	public EUDataGridResult listTestProdInfoValueByCondition(int page, int rows, CS_TestProdInfoValueVo infoValueVo) {
		// 分页处理
		PageHelper.startPage(page, rows);
		System.out.println("======================================");
		System.out.println("page:" + page + ";rows:" + rows + ";查询:" + infoValueVo);
		List<CS_TestProdInfoValueModel> testProdInfoValueModel = testProdInfoValueDao
				.listTestProdInfoValueByCondition(infoValueVo);
		System.out.println("长度:" + testProdInfoValueModel.size());
		System.out.println("======================================");
		// 创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(testProdInfoValueModel);
		// 取记录总条数
		PageInfo<CS_TestProdInfoValueModel> pageInfo = new PageInfo<CS_TestProdInfoValueModel>(testProdInfoValueModel);
		result.setTotal(pageInfo.getTotal());
		return result;
	}

}
